<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.Map"%>
<%@ page import="java.util.HashMap"%>
<%@ page import="com.wxap.util.TenpayUtil"%>
<%@ page import="com.wxap.util.MD5Util"%>
<%@ page import="com.wxap.RequestHandler"%>
<%@ page import="com.wxap.ResponseHandler"%>
<%@ page import="com.wxap.client.TenpayHttpClient"%>
<%@ page import="com.szqhsj.basis.common.NotifyService"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	//---------------------------------------------------------
	//微信支付支付通知（后台通知）示例，商户按照此文档进行开发即可
	//---------------------------------------------------------
	request.setCharacterEncoding("UTF-8");
	response.setCharacterEncoding("UTF-8");
	ResponseHandler resHandler = new ResponseHandler(request, response);
	NotifyService notify = new NotifyService();
	//数据转换成MAP
	Map<String, String> requestMap = notify.parseXmlForPay(request);
	//支付结果
	String return_code = requestMap.get("return_code");
	//回复给微信服务器字符串
	StringBuilder sendContent = new StringBuilder();
	if (return_code == "SUCCESS" || "SUCCESS".equals(return_code)) {
		// 支付成功
		System.out.println("[微信支付:notify_url.jsp]结果:SUCCESS");
		boolean bool = notify.buildQueueMessage(requestMap);
		if (bool) {
			// 可进行本程序自定义操作 如更新支付单号等
			sendContent.delete(0, sendContent.length());
			sendContent.append(notify.execute("SUCCESS", "支付成功"));
		}
	} else {
		System.out.println("[微信支付:notify_url.jsp]结果:FAIL");
		sendContent.delete(0, sendContent.length());
		sendContent.append(notify.execute("FAIL", "支付失败"));
	}
	System.out.println("[微信支付:notify_url.jsp]结果"+sendContent.toString());
	resHandler.sendToCFT(sendContent.toString());
	System.out.println("[微信支付:notify_url.jsp]结果1111"+sendContent.toString());
%>